package com.sample.plove.authener.util;

import java.util.Arrays;

/**
 * PackageName:com.sample.plover.server
 * Author:Administrator
 * Time:21:59
 * Date:2019/4/25
 * Describe: 微信signature校验
 */
public class WechatCheckSignature {
    public static boolean checkSignature(String token, String signature, String timestamp, String nonce) {
        String[] array = new String[]{token, timestamp, nonce};
        Arrays.sort(array);
        String tmpStr = SHA1.encode(array[0] + array[1] + array[2]);
        return tmpStr != null && tmpStr.equals(signature.toUpperCase());
    }
}
